package com.social.model;

import java.util.Date;

public class Log {
    private int id;             // 日志ID
    private String userId;      // 用户ID
    private String scope;       // 可见范围
    private String content;     // 日志内容
    private String[] imgAdreess; // 图片地址数组
    private Date createTime;    // 创建时间
    private int likeNum;        // 点赞数
    private int dislikeNum;     // 点踩数（修正属性名首字母小写）

    public Log() {
        // 默认构造函数
    }

    // 带参构造函数（修正：添加dislikeNum参数）
    public Log(int id, String userId, String scope, String content, String[] imgAdreess,
               Date createTime, int likeNum, int dislikeNum) {
        this.id = id;
        this.userId = userId;
        this.scope = scope;
        this.content = content;
        this.imgAdreess = imgAdreess;
        this.createTime = createTime;
        this.likeNum = likeNum;
        this.dislikeNum = dislikeNum;
    }
    // 在 Log 类中添加此构造函数
    public Log(String userId, String scope, String content, String[] imgAdreess,
               Date createTime, int likeNum) {
        this.userId = userId;
        this.scope = scope;
        this.content = content;
        this.imgAdreess = imgAdreess;
        this.createTime = createTime;
        this.likeNum = likeNum;
        this.dislikeNum = 0;  // 点踩数默认为0
    }

    // Getter 和 Setter 方法
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String[] getImgAdreess() {
        return imgAdreess;
    }

    public void setImgAdreess(String[] imgAdreess) {
        this.imgAdreess = imgAdreess;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public int getLikeNum() {
        return likeNum;
    }

    public void setLikeNum(int likeNum) {
        this.likeNum = likeNum;
    }

    // 新增：dislikeNum 的 getter 和 setter
    public int getDislikeNum() {
        return dislikeNum;
    }

    public void setDislikeNum(int dislikeNum) {
        this.dislikeNum = dislikeNum;
    }

    // 可选：增加点赞数
    public void incrementLikeNum() {
        this.likeNum++;
    }

    // 可选：减少点赞数
    public void decrementLikeNum() {
        if (this.likeNum > 0) {
            this.likeNum--;
        }
    }

    // 可选：增加点踩数
    public void incrementDislikeNum() {
        this.dislikeNum++;
    }

    // 可选：减少点踩数
    public void decrementDislikeNum() {
        if (this.dislikeNum > 0) {
            this.dislikeNum--;
        }
    }
}